<div class="modal fade bs-modal-md" id="modelContent">
	<div class="modal-dialog modal-md" style="width: 960px;">
		<div class="modal-content"></div>
	</div>
</div>

<div class="portlet box green form">
    <div class="portlet-title">
		<div class="caption"><i class="fa fa-cogs"></i>订单 &gt; 订单管理 &gt; 换货订单&gt; 订单详情</div>
		<div class="tools"><a href="javascript:;" class="collapse" data-original-title="" title=""> </a></div>
    </div>
    <div class="portlet-body">
    	<div class="tabbable-line ">
			<ul class="nav nav-tabs ">
				<li class="active"><a href="/orderRepaire/edit?id=$!item.id" class="ajaxify" id="orderInfoLink">订单信息</a></li>
				<li><a href="/orderItem/list3?id=$!item.id" class="ajaxify">订单货品</a></li>
				<li><a href="/orderReceipt/orderBills3?id=$!item.id" class="ajaxify">单据信息</a></li>
				<li><a href="/orderLog/orderLogs3?id=$!item.id" class="ajaxify">订单日志</a></li>
			</ul>
			<div class="tab-content">
				<div class="tab-pane active form">
					
				</div>
			</div>
		</div>
		<div class="portlet-body">
		   	 #if($!item.orderState.name=='待发货')
		   	 <a href="#modelContent" thref="/sendGoods/add3?id=$!item.id" class="btn btn-circle default ajax-model-get" data-toggle="modal">发货</a>
		   	 #end
		   	 #if($!item.orderState.name=='待收货')
		   	 <a href="javascript:;" class="btn btn-circle default" onclick="finishOrder('$!item.id');">完成</a>
		   	 #end
		</div>
		
    	<div class="dataTables_wrapper no-footer">
			<div class="table-scrollable">
				<h2>基本信息</h2>
			      <table class="table table-striped table-bordered table-hover center">
			      	<tbody>
				      	<tr>
				      		<td>订单号</td><td>$!item.id</td>
				      		<td>订单状态</td><td>$!item.orderState.name</td>
				      		<td>原订单号</td><td>$!order.id</td>
				      	</tr>
				      	<tr>
				      		<td>售后单号</td><td>$!item.amOrder</td>
				      		<td>配送方式</td><td>$!item.tranType.name</td>
				      		<td>总物流重量</td><td>$!order.totalWeight</td>
				      	</tr>
				      	<tr>
				      		<td>购买会员</td><td>$!item.username</td>
				      		<td>会员来源</td><td></td>
				      		<td>总物流体积</td><td>$!order.totalVolume</td>
				      	</tr>
				      	<tr>
				      		<td>生成时间</td><td>$!item.createDate</td>
				      		<td>所属企业</td><td>$!company.name</td>
				      		<td>货品总件数</td><td>$!order.totalNum</td>
				      	</tr>
			      	</tbody>
			      </table>
			</div>
			
			
			<div class="table-scrollable">
				<h2>收货信息</h2>
			     
			      <table class="table table-striped table-bordered table-hover">
			      	<tbody>
				      	<tr>
				      		<td>收货人</td><td>$!item.receiver</td>
				      		<td>联系电话</td><td>$!order.shippingInfoModel.phone</td>
				      		<td>收货地址</td><td>$!order.shippingInfoModel.address</td>
				      	</tr>
				      	 
			      	</tbody>
			      </table>
			</div>
			
			<div class="table-scrollable">
			      <table class="table table-striped table-bordered table-hover">
			      	<tbody>
				      	<tr>
				      		<td align="center">
								<input type="hidden" name="id" value="$!item.id">
				      			<input type="hidden" name="orderState" id="orderState" value="$!item.orderState">
								<a class="btn green btn-sm ajaxify" href="/orderRepaire/list?orderState=$!item.orderState"> 
									<i class="fa fa-close"></i>返回
								</a>
				      		</td>
				      	</tr>
			      	</tbody>
			      </table>
			</div>
		</div>
    </div>
</div>
<script src="/assets/scripts/views-date.js" type="text/javascript"></script>
<script type="text/javascript">

 /**
  * 完成订单
  */
  function finishOrder(orderId) {
 	 $.get('/orderRepaire/finishOrder',{'id':orderId},function(data){
 		var res = JSON.parse(data);
 		if(res.code == 0) {
 			toastr.success(res.msg);
 			$('#orderInfoLink').click();
 		} else {
 			toastr.warning(res.msg);
 		}
 	});
 }
 
</script>

